home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_351 / pdc / libsrc.lzh / LibSrc / Math / mod.c < prev    next >
C/C++ Source or Header  |  1990-04-07  |  2KB  |  67 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                              N O T I C E                             *
  4.  *                                                                      *
  5.  *                      Copyright Abandoned, 1987, Fred Fish            *
  6.  *                                                                      *
  7.  *      This previously copyrighted work has been placed into the       *
  8.  *      public domain by the author (Fred Fish) and may be freely used  *
  9.  *      for any purpose, private or commercial.  I would appreciate     *
  10.  *      it, as a courtesy, if this notice is left in all copies and     *
  11.  *      derivative works.  Thank you, and enjoy...                      *
  12.  *                                                                      *
  13.  *      The author makes no warranty of any kind with respect to this   *
  14.  *      product and explicitly disclaims any implied warranties of      *
  15.  *      merchantability or fitness for any particular purpose.          *
  16.  *                                                                      *
  17.  ************************************************************************
  18.  */
  19.  
  20. /*
  21.  *  FUNCTION
  22.  *
  23.  *      mod   double precision modulo
  24.  *
  25.  *  KEY WORDS
  26.  *
  27.  *      mod
  28.  *      machine independent routines
  29.  *      math libraries
  30.  *
  31.  *  DESCRIPTION
  32.  *
  33.  *      Returns double precision modulo of two double
  34.  *      precision arguments.
  35.  *
  36.  *  USAGE
  37.  *
  38.  *      double mod (value, base)
  39.  *      double value;
  40.  *      double base;
  41.  *
  42.  *  PROGRAMMER
  43.  *
  44.  *      Fred Fish
  45.  *
  46.  */
  47.  
  48.  
  49. #include <stdio.h>
  50. #include "pml.h"
  51.  
  52. double mod (value, base)
  53. double value;
  54. double base;
  55. {
  56.     double intpart;
  57.     extern double modf ();
  58.  
  59.     DBUG_ENTER ("mod");
  60.     DBUG_4 ("modin", "args %le %le", value, base);
  61.     value /= base;
  62.     value = modf (value, &intpart);
  63.     value *= base;
  64.     DBUG_3 ("modout", "result %le", value);
  65.     DBUG_RETURN (value);
  66. }
  67.